package com.deworkes.admin.web.plugs;

import com.deworkes.admin.web.vo.Result;
import com.deworks.admin.common.constants.ErrorConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    public Result defaultError(Exception e) {
        log.error("Global exception handle", e);
        return Result.error(ErrorConstants.SYSTEM_ERROR_CODE, ErrorConstants.SYSTEM_ERROR);
    }
}
